/*
 * TMap Designer - A Thematic Map design software
 * Copyright (C) 2006 World Health Organization
 * http://www.who.int
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package who.tmap.toolkit.shape.annotation.impl;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

import who.tmap.bo.TextStyle;

public abstract class BaseTextMapShapeImpl extends BaseAnnotationGraphicShapeImpl {
	
	protected String fontName;
	protected int fontStyle;
	protected int fontSize;	
	
	BaseTextMapShapeImpl() {
		super();
	}
	
	/**
	 * Nothing to fill for a text shape!
	 */
	public void fill( Graphics g) {
	}
	
	/**
	 * Nothing to fill for a text shape!
	 */
	public void fill( Graphics g, Color color ) {
	}	
	
	public boolean contains( Point2D p ) {
		return bounds != null ? bounds.contains( p ) : false;
	}
	
	public boolean isInside( Rectangle2D r ) {
		return r != null && bounds != null ? r.contains( bounds )
						 				   : false;	
	}

	/**
	 * Not implemented at the moment
	 * May be in another version
	 */
	public void updateShape(int idx, Point2D p) {    
	}		
	
	public void applyStyle( TextStyle style ) {
		setFontName( new String( style.getFontName() ) );
		setFontSize( style.getFontSize() );		
		setFontStyle( style.getFontStyle() );
	}	

	public String getFontName() {
		return fontName;
	}

	public void setFontName(String fontName) {
		this.fontName = fontName;
	}

	public int getFontSize() {
		return fontSize;
	}

	public void setFontSize(int fontSize) {
		this.fontSize = fontSize;
	}

	public int getFontStyle() {
		return fontStyle;
	}

	public void setFontStyle(int fontStyle) {
		this.fontStyle = fontStyle;
	}
	
}
